package com.lagou.server;

import com.lagou.component.decoder.RpcRequestJsonDecoder;
import com.lagou.handler.UserServerHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.string.StringEncoder;

public class ServerChannelInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new StringEncoder());
        pipeline.addLast(new RpcRequestJsonDecoder());
        pipeline.addLast(new UserServerHandler());
    }

}
